package com.p2l.letterblocks;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;

public class Coin extends Sprite {
	private boolean collected;
	
	public Coin(float x, float y, float height, float width, Bitmap bitmap) {
		super(x, y, height, width, bitmap);
		collected = false;
	}
	
	@Override
	public void onDraw(Canvas c, int delta, float x) {
		Rect r = new Rect((int)(getX() - x), (int)(getY()), (int)(getX() - x + getWidth()), (int)(getY() + getHeight()));
		c.drawBitmap(getBitmap(), null, r, getPaint());
		collected = false;
	}
	
	public boolean isColliding(Sprite s) {
		if (getX() <= s.getX() + s.getWidth() && getX() + getWidth() >= s.getX() && getY() <= s.getY() + s.getHeight() && getY() + getHeight() >= s.getY())
			return true;
		else
			return false;
	}

	public boolean isCollected() {
		return collected;
	}

	public void setCollected(boolean collected) {
		this.collected = collected;
	}
}